package com.Laboratory.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author acok
 * @description: 时间工具包
 * @Date 2022/12/17 19:46
 * @Version 1.0
 */
public class timeUtil {

    public static long DAY=1000*24*60*60;
    public static long HOUR=1000*60*60;
    public static long MINUTE=1000*60;
    public static long SECOND=1000;

    private static final SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static int getTimeDifference(String startTime,String endTime,long timeCut)
            throws ParseException {
        return (int) ((format.parse(endTime).getTime()-format.parse(startTime).getTime())/timeCut);
    }
  /**
       * @return: 获取当前时间
       * @param: 时间对象
       * @description: 获取当前指定格式时间字符串
       * @Author: Acok
       * @mbggenerated 2023/4/25
       */
    public static String getNowTime(Date date){
        return format.format(date);
    }
}
